import time
n0 = open('m1_sorted.txt','r')
n1 = open('m2_reverse.txt','r')
n2 = open('m3_shuffle.txt','r')
name0 = n0.name.split(".")[0]
name1 = n1.name.split(".")[0]
name2 = n2.name.split(".")[0]

a = n0.read().split()
a = [int (i) for i in a]
a1 = n1.read().split()
a1 = [int (i) for i in a1]
a2 = n2.read().split()
a2 = [int (i) for i in a2]
def sort(n):
    for j in range(1,len(n)):
        for i in range(len(n)-j):
            if n[i]>n[i+1]:
                n[i],n[i + 1]=n[i+1],n[i]
st = time.time()
sort(a)
p = time.time()
p1 = time.time()
sort(a1)
p1 = time.time()
p2 = time.time()
sort(a2)
p2 = time.time()
print('m1_sorted',round((p-st)*1000),"milliseconds")
print('m2_reverse',round((p1-p1)*1000),"milliseconds")
print('m3_shuffle',round((p2-p2)*1000),"milliseconds")